<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateBanner extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('banner', function (Blueprint $table) {
            $table->id();
            $table->unsignedInteger('brandId')->comment('品牌id')->default(0);
            $table->string('name', 120)->comment('广告名称')->default('');
            $table->string('img', 250)->default('')->comment('图片');
            $table->string('extraImg', 250)->default('')->comment('附加图片');
            $table->unsignedTinyInteger('type')->comment('类型 0-首页，1-banner，2-副屏，3-弹窗')->default(0);
            $table->unsignedTinyInteger('shopType')->comment('店铺类型 0-全部，1-加盟，2-直营，3-部分选择')->default(0);
            $table->unsignedTinyInteger('effectiveType')->comment('类型 0-长期有效，1-固定日期')->default(0);
            $table->unsignedInteger('startAt')->default(0)->comment('生效日期');
            $table->unsignedInteger('endAt')->default(0)->comment('失效日期');
            $table->integer('sort')->comment('排序')->default(0);
            $table->unsignedTinyInteger('status')->comment('状态 1 - 禁用 0 - 正常 ')->default(0);
            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('updatedAt')->default(0)->comment('更新时间');
            $table->unsignedInteger('createdByUid')->default(0)->comment('创建人');
            $table->unsignedInteger('updatedByUid')->default(0)->comment('更新人');
            $table->tinyInteger("isDeleted")->default(0)->comment("是否删除,0:未删除,1:已删除");
            $table->index("brandId", "idx_brandId");
            $table->collation = 'utf8mb4_general_ci';
            $table->comment = 'banner图片配置表';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('banner');
    }
}
